package com.congee02;

public class LengthOfLIS_TL {

    public int lengthOfLIS(int... nums) {
        return process(nums, Integer.MIN_VALUE, 0);
    }

    private int process(int[] nums, int prev, int index) {
        if (index == nums.length) {
            return 0;
        }

        int taken = 0;
        if (nums[index] > prev) {
            taken = 1 + process(nums, nums[index], index + 1);
        }
        int notTaken = process(nums, nums[index], prev);

        return Math.max(taken, notTaken);
    }

}
